//
//  AppDelegate+HRUmeng.m
//  Hear
//
//  Created by mac on 2017/3/22.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "AppDelegate+HRUmeng.h"

#import <UMSocialCore/UMSocialCore.h>

@implementation AppDelegate (HRUmeng)

- (void)setupUMeng {
    NSString *UmengAppkey;
#if DEBUG
    UmengAppkey = @"5a3cda52b27b0a626e000097";
#else
    UmengAppkey = @"58cfa43645297d58940002fa";
#endif

    UMConfigInstance.appKey = UmengAppkey;
    UMConfigInstance.channelId = @"";
    [MobClick startWithConfigure:UMConfigInstance];//配置以上参数后调用此方法初始化SDK！
    [MobClick setAppVersion:XcodeAppVersion]; //参数为NSString * 类型,自定义app版本信息，如果不设置，默认从CFBundleVersion里取
    
    /* 打开调试日志 */
    [[UMSocialManager defaultManager] openLog:YES];
    
    
    /* 设置友盟appkey */
    [[UMSocialManager defaultManager] setUmSocialAppkey:UmengAppkey];
    
    [self configUSharePlatforms];
    
    [MobClick setLogEnabled:YES];
    
}

- (void)configUSharePlatforms {
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:@"1105978487" appSecret:@"PaEN3JBhcynISpok" redirectURL:@"http://www.umeng.com/social"];
    
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_Sina appKey:@"2622600627" appSecret:@"PaEN3JBhcynISpok" redirectURL:@"http://www.umeng.com/social"];
    
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"wxfa62233b4620b7d6" appSecret:@"19fe36b5002057428dcf5259b4147bc9" redirectURL:@"http://www.umeng.com/social"];

}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    return [[UMSocialManager defaultManager] handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    return [[UMSocialManager defaultManager] handleOpenURL:url];
}


@end
